home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / programs_-_include / ASM-I386 / PAGE.H < prev    next >
C/C++ Source or Header  |  1999-09-17  |  3KB  |  92 lines

  1. #ifndef _I386_PAGE_H
  2. #define _I386_PAGE_H
  3.  
  4. /* PAGE_SHIFT determines the page size */
  5. #define PAGE_SHIFT    12
  6. #define PAGE_SIZE    (1UL << PAGE_SHIFT)
  7. #define PAGE_MASK    (~(PAGE_SIZE-1))
  8.  
  9. #ifdef __KERNEL__
  10. #ifndef __ASSEMBLY__
  11.  
  12. #define STRICT_MM_TYPECHECKS
  13.  
  14. #define clear_page(page)    memset((void *)(page), 0, PAGE_SIZE)
  15. #define copy_page(to,from)    memcpy((void *)(to), (void *)(from), PAGE_SIZE)
  16.  
  17. #ifdef STRICT_MM_TYPECHECKS
  18. /*
  19.  * These are used to make use of C type-checking..
  20.  */
  21. typedef struct { unsigned long pte; } pte_t;
  22. typedef struct { unsigned long pmd; } pmd_t;
  23. typedef struct { unsigned long pgd; } pgd_t;
  24. typedef struct { unsigned long pgprot; } pgprot_t;
  25.  
  26. #define pte_val(x)    ((x).pte)
  27. #define pmd_val(x)    ((x).pmd)
  28. #define pgd_val(x)    ((x).pgd)
  29. #define pgprot_val(x)    ((x).pgprot)
  30.  
  31. #define __pte(x)    ((pte_t) { (x) } )
  32. #define __pmd(x)    ((pmd_t) { (x) } )
  33. #define __pgd(x)    ((pgd_t) { (x) } )
  34. #define __pgprot(x)    ((pgprot_t) { (x) } )
  35.  
  36. #else
  37. /*
  38.  * .. while these make it easier on the compiler
  39.  */
  40. typedef unsigned long pte_t;
  41. typedef unsigned long pmd_t;
  42. typedef unsigned long pgd_t;
  43. typedef unsigned long pgprot_t;
  44.  
  45. #define pte_val(x)    (x)
  46. #define pmd_val(x)    (x)
  47. #define pgd_val(x)    (x)
  48. #define pgprot_val(x)    (x)
  49.  
  50. #define __pte(x)    (x)
  51. #define __pmd(x)    (x)
  52. #define __pgd(x)    (x)
  53. #define __pgprot(x)    (x)
  54.  
  55. #endif
  56. #endif /* !__ASSEMBLY__ */
  57.  
  58. /* to align the pointer to the (next) page boundary */
  59. #define PAGE_ALIGN(addr)    (((addr)+PAGE_SIZE-1)&PAGE_MASK)
  60.  
  61. /*
  62.  * This handles the memory map.. We could make this a config
  63.  * option, but too many people screw it up, and too few need
  64.  * it.
  65.  *
  66.  * A __PAGE_OFFSET of 0xC0000000 means that the kernel has
  67.  * a virtual address space of one gigabyte, which limits the
  68.  * amount of physical memory you can use to about 950MB. If
  69.  * you want to use more physical memory, change this define.
  70.  *
  71.  * For example, if you have 2GB worth of physical memory, you
  72.  * could change this define to 0x80000000, which gives the
  73.  * kernel 2GB of virtual memory (enough to most of your physical memory
  74.  * as the kernel needs a bit extra for various io-memory mappings)
  75.  *
  76.  * IF YOU CHANGE THIS, PLEASE ALSO CHANGE
  77.  *
  78.  *    arch/i386/vmlinux.lds
  79.  *
  80.  * which has the same constant encoded..
  81.  */
  82. #define __PAGE_OFFSET        (0xC0000000)
  83.  
  84. #define PAGE_OFFSET        ((unsigned long)__PAGE_OFFSET)
  85. #define __pa(x)            ((unsigned long)(x)-PAGE_OFFSET)
  86. #define __va(x)            ((void *)((unsigned long)(x)+PAGE_OFFSET))
  87. #define MAP_NR(addr)        (__pa(addr) >> PAGE_SHIFT)
  88.  
  89. #endif /* __KERNEL__ */
  90.  
  91. #endif /* _I386_PAGE_H */
  92.